package com.mmy.service.plane.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mmy.controller.Common;
import com.mmy.dao.plane.TPlaneBaseRepository;
import com.mmy.dao.plane.VPlaneBaseRepository;
import com.mmy.domain.plane.TPlaneBase;
import com.mmy.domain.plane.VPlaneBase;
import com.mmy.service.plane.TPlaneBaseService;

@Service
public class TPlaneBaseServiceImpl implements TPlaneBaseService {

	@Autowired
	TPlaneBaseRepository tPlaneBaseRepository;
	@Autowired
	VPlaneBaseRepository vPlaneBaseRepository;
	@Autowired
	Common common;

	/**
	 * 查找全部
	 * 
	 * @param
	 * @return
	 */
	public List<VPlaneBase> findAll() {
		// TODO Auto-generated method stub
		return vPlaneBaseRepository.findAll();
	}

	/**
	 * 获取最大值
	 * 
	 * @return 返回值说明 最大ID
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.17
	 */
	public int getMaxPlaneID() {
		// 流水号
		Object objCode = tPlaneBaseRepository.getMaxPlaneID();
		int iID = 0;
		if (objCode != null) {
			iID = Integer.parseInt(objCode.toString());
		}
		return iID;
	}

	/**
	 * 新增id
	 * 
	 * @param
	 * @return
	 */
	public void save(int planeID) {
		// TODO Auto-generated method stub
		tPlaneBaseRepository.save(planeID);
	}

	/**
	 * 新增
	 * 
	 * @param
	 * @return
	 */
	public void save(TPlaneBase tPlaneBase) {
		// TODO Auto-generated method stub
		tPlaneBaseRepository.save(tPlaneBase);
	}

	/**
	 * 删除
	 * 
	 * @param
	 * @return
	 */
	public void delPlaneBase(List<Integer> lstPlaneID) {
		// TODO Auto-generated method stub
		tPlaneBaseRepository.delPlaneBase(lstPlaneID);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public TPlaneBase findByPlaneID(int iPlaneID) {
		// TODO Auto-generated method stub
		return tPlaneBaseRepository.findByPlaneID(iPlaneID);
	}

	/**
	 * 通过name查找
	 * 
	 * @param
	 * @return
	 */
	public List<VPlaneBase> findByName(String strPlaneName) {
		// TODO Auto-generated method stub
		return vPlaneBaseRepository.findByName(strPlaneName);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public VPlaneBase findByID(int iPlaneID) {
		// TODO Auto-generated method stub
		return vPlaneBaseRepository.findByID(iPlaneID);
	}
}
